package tjut.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import tjut.bean.UsersEntity;
import tjut.dao.IUserInfoDao;
import tjut.mapper.UsersEntityMapper;

@Repository("userDao")
public class UserInfoDaoImpl implements IUserInfoDao {
	// 依赖注入，组合mapper对象（面向接口的编程）


	@Autowired
	private UsersEntityMapper userMapper;

	@Override
	// @Transactional(readOnly = true, propagation = Propagation.NEVER)


	public List<UsersEntity> selectAllUsersInfo() {
		// 调用mapper进行处理


		List<UsersEntity> lstUsers = userMapper.selectUsersInfoList();
		return lstUsers;

		/*

		 * //测试保存 UsersEntity userE = new UsersEntity();

		 * userE.setUsername("xiaoming23"); userE.setUserage(20);

		 * userE.setUseraddress("tjut"); userE.setUserid(14);

		 * 

		 * userMapper.saveUsersInfo(userE);

		 * 

		 * System.out.println("抛出异常。。。"); throw new RuntimeException("自定义异常");

		 */
	}

}
